﻿{% extends "base.html" %}
{% block LeftContent %}
	<!-- Powered by PBDigg -->
	<div class="pb_mainbox_show" id="tid_1226">
		<div class="pb_box_l_show">
			<a href="/entry/{{ entry.id }}/" title="{{ entry.title }}" target="_blank"><h1>{{ entry.title }}</h1></a>
	<p class="pb_box_right_show">Visame published on<span class="d">{{ entry.pub_date_str }}</span> In Category:<a href="/cat/{{ entry.category.id }}/1/" target="_blank">{{ entry.category.name|escape }}</a></p>

			
			</div>
		<div class="pb_box_lrad2_show" id="content">
		<!--topimg区域 开始-->
		<div style="float:right;text-align:right;width:128px;heigth:128px;border:0px #000 solid;"><a href="/cat/{{ entry.category.id }}/1/" target="_blank"><img src="/static/images/{{ entry.category.imgname|escape }}.png" alt="{{ entry.category.name|escape }}" style="" class="topicimg" /></a></div>
		<!--topimg区域 结束-->
		<!--expert-->
		{{ entry.excerpt }}

	<!-- dex AdMarketplace Tag : dexplatform.com  -  (458) 468 x 60 Banner -->
<IFRAME ALLOWTRANSPARENCY=FALSE FRAMEBORDER=0 HSPACE=0 VSPACE=0 MARGINWIDTH=0 MARGINHEIGHT=0 SCROLLING=NO WIDTH=468 HEIGHT=60 SRC=http://marketplace.dexplatform.com/marketplace/delivery/display.php?f=468x60&w=468&h=60&o=458&s=659></IFRAME>
<!-- End of ad tag : dex AdMarketplace -->

		<!--content-->
		{{ entry.content }}
		<div class="clear"></div>
		<div id="toollinks">
			Tags:
				{% for tag in entry.tags %}
				<a href="/tag/{{ tag.id }}/1/" target="_blank" title="{{ tag.name|escape }}">{{ tag.name|escape }}</a>
				{% endfor %}
			<div class="clear"></div>
		</div>
</div>
	<!-- 管理选项 -->
		<!-- 管理选项 -->

		</div>
	<!-- 评论 -->

	<div class="comment" id="coment_reply">
		<!--评论内容-->	
		<div class="comments_title"><span>In total <strong>{{ entry.commentscount}}</strong> comments</span><h2>COMMENT</h2></div>
{% for comment in entry.comments %}
<div id="comment_{{ comment.id }}" class="comment_body next_1">
			<div id="comment_head_{{ comment.id }}" class="comment_head">
			<div class="comment_digg">
	<span onclick="myrecomment('{{ comment.id }}','{{ comment.user_name }}')" class="altspan">[Reply]</span>
	{% if is_admin %}
	<span class="altspan"><a href="/Visame/delcomment/{{ comment.id }}/" >[Delete]</a></span>
	{% endif %}
			</div>
			<div class="comment_userimg">
				<strong>{{ comment.user_name }}</strong> published on {{ comment.pub_date_str }} </div>
			</div>
			<div class="comment_user_img"><img src="/static/images/user.png" alt="Default" /> </div>
			<div id="comment_content_{{ comment.id }}" class="comment_content">{{ comment.content|linebreaksbr }}</div>
</div>
{% endfor %}
		<div class="clear"></div>
	</div>
	<!-- 添加评论 -->
		<div id="comments">
		<div class="clear"></div>
		<div id="addform">
<form action="/PostComment/{{ entry.id }}/" method="post" id="commentform">
<div id="comment_area">
<p><input type="text" name="user_name" id="user_name"  size="25" tabindex="1" 
{% if is_admin %}
value="Admin"
{% endif %}
/>
<label for="author">Name <span style='color:red'>*</span></label></p>
<p><input type="text" name="user_email" id="user_email"  size="25" tabindex="2" 
{% if is_admin %}
value="Admin"
{% endif %}
/>
<label for="email">Email(will not be published) <span style='color:red'>*</span></label></p>
<p id="checkarea">Anti-Spam.Please Calculate:<span style="color:#D50000" id="disp_check">3+6=</span>
<input type="hidden" name="checknum" id="checknum" value="3+6"/>
<input type="text" name="checkret" id="checkret" 
{% if is_admin %}
value="9"
{% else %}
value="" 
{% endif %}
size="5" tabindex="4" />
</p>
</div>
<p><textarea name="content" id="mycontent" style="width:96%"  rows="10" tabindex="4"></textarea></p>
<div id="s_msg" style="display:none;color:red"></div>
<p><input name="submit" type="submit" id="submit" onclick="mycomment()" tabindex="5" value="Post Comment" />
</p>
</form>
<script type="text/javascript">
function myrecomment(rid, author)

{

	var reply_body = $('#mycontent');

	var quote = $('#comment_content_' + rid).text();

	var add = '';

	if (quote.length > 50)

	{

		add = "...";

	}

	quote = quote.substr(0, 50) + add;

	reply_body.val('[Reply to ' + author + ']['+quote+']'+'\n');

	reply_body[0].focus();

	return;

}

function showinfo(msg)
{
  alert(msg);
}
function mycomment()
{
$('#commentform').ajaxForm({
              	type:'post',
              	dataType:'json',
              	beforeSubmit:function(formData,jqForm,options){
              		   var form = jqForm[0];
              		   if (form.user_name)
              		   {

	              			 if (!form.user_name.value)
		              		 {
		              		  showinfo('请输入你的名字!');
		              		  form.user_name.focus();
		              		  return false;
		              		 }
		              		 if (!form.user_email.value)
		              		 {
		              		 	showinfo('请输入邮件地址');
		              		 	form.user_email.focus();
		              		 	return false;
		              		 }
           		       }
					   if (!form.checkret.value)
					   {
					   showinfo('请计算简单表达式');
						form.user_email.focus();
		              	return false;	   
					   }
           		        if(eval(form.checknum.value)!=form.checkret.value)
							             {
							               alert('计算错误，这个算术好像在幼儿园学过的吧？');
							               form.checkret.value='';
							               form.checkret.focus();
							               return false;
							             }
                  		 if (!form.content.value)
                  		 {
                  		 	showinfo('请输入留言内容');
                  		 	form.content.focus();
                  		 	return false;
                  		 }

                  		 $('#s_msg').text('Posting comments...').show();

	              		 return true;

              		},
              	success:function(data){
              		  if (data[0])
              		  {
              		  	$("#coment_reply").html(data[1]);
            		  	$('#s_msg').text('Comment posted!');
              		  	$('#mycontent').val('');
              		  }
              		}
              });
			  }
</script>
		</div>
	</div>
		<!-- 添加评论结束 -->
<!--左侧内容结束-->
{% endblock %}